class zhan {//定义栈的方法
    constructor(){
        this.item={}
        this.count=0
    }
    push(element){//入
       this.item[this.count]=element
       this.count++
    }
    isEmpty(){
        return this.count==0
    }
    pop(){//出
        if(this.isEmpty()){
            return undefined
        }
        this.count--
        let rem=this.item[this.count]
        delete this.item[this.count]
        return rem
    }
    size(){//长度
        return this.count
    }
}
function goback(string){
    let z=new zhan()
    for(let i=0;i<string.length;i++){
       z.push(string[i]);//入栈
    }
    let Rstring=""
    while(z.size()>0){
        Rstring+=z.pop()//出栈
    }
    if(string==Rstring){//作比较
        return true
    }else{
        return false
    }
}
console.log(goback("1234321"));